package cn.com.taiji.oospub.wechat.common.tool;

import java.text.DecimalFormat;
import java.text.NumberFormat;

public abstract class DoubleTools {

    public static String doubleToString(Double value) {
        
        return value == null ? "":value+"";
    }
    
    public static String IntegerToString(Integer value) {
    	
    	return value == null ? "":value+"";
    }
    
    public static Double  doubleNumberFormat2(double num) {
        NumberFormat form = NumberFormat.getInstance();
        if (form instanceof DecimalFormat) {
            ((DecimalFormat) form).applyPattern("#0.00#");
            ((DecimalFormat) form).setMaximumFractionDigits(2);
        }
        String value = form.format(num);
        return Double.valueOf(value);
    }
    public static Double  doubleNumberFormat1(double num) {
        NumberFormat form = NumberFormat.getInstance();
        if (form instanceof DecimalFormat) {
            ((DecimalFormat) form).applyPattern("#0.0#");
            ((DecimalFormat) form).setMaximumFractionDigits(2);
        }
        String value = form.format(num);
        return Double.valueOf(value);
    }
}
